package com.wengluobiancheng.demo04;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo02 {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10010);
        Socket accept = ss.accept();
        InputStream is = accept.getInputStream();
        int s;
        while ((s = is.read()) != -1) {
            System.out.println(s);
        }
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(accept.getOutputStream()));
        bw.write("..");
        bw.newLine();
        bw.flush();

        bw.close();
        ss.close();
        accept.close();

    }
}
